package com.wanmait.wanmarecruit.config;

import com.wanmait.wanmarecruit.interceptor.WebCompanyLoginInterceptor;
import com.wanmait.wanmarecruit.interceptor.WebCookieLogInterceptor;
import com.wanmait.wanmarecruit.interceptor.WebLoginInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;

@Configuration
public class WebConfig implements WebMvcConfigurer {

    @Resource
    private WebLoginInterceptor webLoginInterceptor;
    @Resource
    private WebCookieLogInterceptor webCookieLogInterceptor;
    @Resource
    private WebCompanyLoginInterceptor webCompanyLoginInterceptor;
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(webCookieLogInterceptor).addPathPatterns("/web/personal/**").excludePathPatterns("/web/personal/signIn").excludePathPatterns("web/personal/login").excludePathPatterns("/web/personal/signUp").excludePathPatterns("/web/personal/signUpUserInfo/**").excludePathPatterns("/web/personal/signUpExp/**").excludePathPatterns("/web/personal/inc/**").excludePathPatterns("/webSocket/**");
        registry.addInterceptor(webLoginInterceptor).addPathPatterns("/web/personal/curriculumVitae").addPathPatterns("/web/personal/homepage/**").addPathPatterns("/web/personal/userNotice").addPathPatterns("/web/personal/personalCenter");
//        registry.addInterceptor(webCompanyLoginInterceptor).addPathPatterns("/web/companies/**").excludePathPatterns("/web/companies/companySignIn","/web/companies/companySignUp");
    }
}
